clear all;
close all;
clc;

dbstop if error;

n = -2:10;
x = [1:7, 6:-1:1];
y1 = fliplr(x);
ny1 = -fliplr(n) + 5;
x1 = x;
nx1 = n + 3;

[xe, x1e, ny2] = sigindex(x, n, x1, nx1);
y2 = xe.*x1e;

[y1e, y2e, ny] = sigindex(y1, ny1, y2, ny2);
y = 0.2*y1e + 0.3*y2e;

% plot
stem(ny, y, 'fill', 'MarkerSize', 2);